package com.cheng.frame;

import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.border.TitledBorder;

import com.cheng.util.DataUtil;


public class InfoShowPanel extends JScrollPane {

	private static final long serialVersionUID = 1L;
	private JTextPane infoShowTextPane;
	private InfoShowPanel infoShowPanel;

	public InfoShowPanel() {
		infoShowPanel = this;
		infoShowPanel.setBorder(BorderFactory.createTitledBorder(null, "信息确认", TitledBorder.LEADING, TitledBorder.ABOVE_TOP, new Font("SansSerif",
				Font.BOLD, 12), new Color(59, 59, 59)));
		infoShowPanel.setViewportView(getTextPane());
	}
	
	public InfoShowPanel getPanel() {
		if (infoShowPanel == null) {
			infoShowPanel = new InfoShowPanel();
		}
		return infoShowPanel;
	}

	private JTextPane getTextPane() {
		if (infoShowTextPane == null) {
			infoShowTextPane = new JTextPane();
			infoShowTextPane.setText(DataUtil.instance().infoShow());
			infoShowTextPane.setEditable(false);
		}
		return infoShowTextPane;
	}
	
	public void showInfo(){
		infoShowTextPane.setText(DataUtil.instance().infoShow());
	}

}
